# -*- coding: utf-8 -*-
# @Time : 2019/1/10 17:20
# @Author : Administrator
# @File : read_data.py
# @Project : code
# @title : 读取数据
import xlrd
class ReadData():
    def read_excel(self):
        work_book=xlrd.open_workbook("loginData.xlsx")
        work_sheet=work_book.sheets()[0]
        rows=work_sheet.nrows    #行数
        # cols=work_sheet.ncols     #列数
        # print(rows)
        # print(cols)
        key1=work_sheet.cell(0,0).value
        key2=work_sheet.cell(0,1).value
        key3=work_sheet.cell(0,2).value
        key4=work_sheet.cell(0,3).value
        list=[]
        for i in range(1,rows):
            dict={}
            dict[key1]=work_sheet.row_values(i)[0]
            dict[key2]=work_sheet.row_values(i)[1]
            dict[key3] = work_sheet.row_values(i)[2]
            dict[key4] = work_sheet.row_values(i)[3]
            list.append(dict)

        # print(list)
        return list
if __name__ == '__main__':
    read=ReadData()
    read.read_excel()

